<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>


    <title>My JSP 'courseAll.jsp' starting page</title>

    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.min.css">
    <style type="text/css">
        .div_list {
            width: 75%;
            margin: 0 auto;
            margin-top: 50px;
            margin-left: 20%;

        }
        #tableClass{
            margin:0 auto;
            width: 100%

        }
        .form1{
            width: 200px;
            display: inline-block
        }
        font {
            color: red;
            font-weight: bold;
            text-align: center;
        }
        table{
            margin:0 auto;

        }
        table tr td{
            text-align: center;
            width:150px;
            height:40px;
        }
        a{
            text-decoration: none;
            cursor:pointer;
        }
    </style>
    <script src="${pageContext.request.contextPath}/js/jquery-1.11.1.min.js"></script>

    <script type="text/JavaScript">
        //分页
        function getPage(page){
            //1.把page设置到查询表单的隐藏域
            $("#page").val(page);
            //2.获取表单对象提交
            $("#myForm").submit();
        }
    </script>
</head>

<body>
<h4 align="center">
    <form action="${pageContext.request.contextPath}/ServletFindAllBorrows" method="post" id="myForm">

        <!--编写一个当前页的隐藏域  -->
        <input type="hidden" name="page" id="page" value="1">
    </form>
</h4>
<div class="div_list panel panel-default">
    <div class="panel-heading">用户信息</div>
    <table class="table panel-body" id="tableClass">
        <tr>
            <td>编号</td>
            <td>账号</td>
            <td>姓名</td>
            <td>图书名称</td>
            <td>借书时间</td>
            <td>还书时间</td>
            <td>状态</td>
            <td>操作</td>
        </tr>
        <c:forEach var="list" items="${pageUtil.list}">
            <tr>
                <td>${list.getUbid() }</td>
                <td>${list.getUser().getUnum()}</td>
                <td>${list.getUser().getUname()}</td>
                <td>${list.getBook().getBname()}</td>
                <td>${list.getBbooksdate()}</td>
                <td>${list.getRbookdate() }</td>
                <td>${list.getUbstate()==1?"未还":"已还"}</td>
                <td><a href="ServletDeleteBorrow?ubid=${list.getUbid()}" onclick="return confirm('是否确认删除？')">删除借阅记录</a></td>

            </tr>
        </c:forEach>
        <tr>
            <td colspan="9">总记录数：${pageUtil.totalCount}
                当前页/总页数：${pageUtil.currentPage}/${pageUtil.totalPages} &nbsp;&nbsp;&nbsp;
                <a href="#" onclick="getPage(1)">首页</a>
                <a href="#" onclick="getPage(${pageUtil.prevPage })">上一页</a>
                <a href="#" onclick="getPage(${pageUtil.nextPage })">下一页</a>
                <a href="#" onclick="getPage(${pageUtil.totalPages })">尾页</a>
            </td>
        </tr>

    </table>
</div>
</body>
</html>
